#include<iostream>
#include<string>
#include<cstring>
#include<memory>
#include<fstream>
#include<jsoncpp/json/json.h>
using namespace std;
int main(){
    Json::Value root;
    bool res;
    string errors;
    {
        //new
        unique_ptr<Json::CharReader>p_reader(Json::CharReaderBuilder().newCharReader());
        //read
        ifstream ifs("data.json");
        char buffer[1024];
        bzero(&buffer,sizeof buffer);
        ifs.read(buffer,sizeof buffer);
        //deser
        res=p_reader->parse(buffer,buffer+1023,&root,&errors);
    }
    //error
    if(!res){
        cout<<errors;
        exit(1);
    }
    //take
    cout<<root["name"].asString()<<endl;
    cout<<root["age"].asInt()<<endl;
    for(auto e:root["scores"]){
        cout<<e.asFloat()<<endl;
    }
    return 0;
}